//
//  LY_Topic_CollectionViewCell.m
//  iSee
//
//  Created by dllo on 16/8/7.
//  Copyright © 2016年 LY. All rights reserved.
//
#import "SE_Square_CollectionViewCell.h"
#import "UIImageView+WebCache.h"
#import "SE_Square_Model.h"


#define WIDTH self.contentView.bounds.size.width
#define HEIGHT self.contentView.bounds.size.height

@interface SE_Square_CollectionViewCell()

@property (nonatomic, retain) UIImageView *coverImage;
@property (nonatomic, retain) UILabel *titleLabel;

@end

@implementation SE_Square_CollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.coverImage = [[UIImageView alloc]init];
        [self.contentView addSubview:self.coverImage];
        
        self.titleLabel = [[UILabel alloc]init];
        self.titleLabel.font = [UIFont systemFontOfSize:20];
        [self.titleLabel setTextColor:[UIColor whiteColor]];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.titleLabel];
        
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    self.coverImage.frame = self.contentView.bounds;
    self.titleLabel.frame = CGRectMake(0, self.contentView.center.y - HEIGHT * 0.1, WIDTH, HEIGHT * 0.2);
}

-(void)setSquareModel:(SE_Square_Model *)squareModel{
    _squareModel = squareModel;
    [self.coverImage sd_setImageWithURL:[NSURL URLWithString:squareModel.image] placeholderImage:[UIImage imageNamed:@"holder"]];
    self.titleLabel.text = squareModel.title;
}

@end













